package com.tongshu.naive.chat.event;

import com.tongshu.naive.chat.infrastructure.util.BeanUtil;
import com.tongshu.naive.chat.infrastructure.util.CacheUtil;
import com.tongshu.naive.chat.ui.view.login.ILoginEvent;
import io.netty.channel.Channel;
import protocol.login.LoginRequest;

public class LoginEvent implements ILoginEvent {
    @Override
    public void doLoginCheck(String userId, String userPassword) {
        Channel channel = BeanUtil.getBean("channel", Channel.class);
        channel.writeAndFlush(new LoginRequest(userId, userPassword));
        CacheUtil.userId = userId;
    }
}
